package com.asha.md360player4android.vr.display;

import android.graphics.Point;

import com.asha.vrlib.strategy.display.DisplayModeManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fuyao on 2017/1/18.
 */

public class LeftRightBlockStrategy extends AbsBlockStrategy {
    private static int DISPLAY_SIZE = 2;

    public LeftRightBlockStrategy(DisplayModeManager.Params params) {
        super(params);
    }

    @Override
    public void onSurfaceChanged(int width, int height) {
        mPoss = new ArrayList<>(DISPLAY_SIZE);
        mSizes = new ArrayList<>(DISPLAY_SIZE);
        Point tempPos;
        Point tempSize;
        for (int i = 0; i < DISPLAY_SIZE; i++) {
            tempPos = new Point(width / DISPLAY_SIZE * i, 0);
            mPoss.add(tempPos);
            tempSize = new Point(width / DISPLAY_SIZE, height);
            mSizes.add(tempSize);
        }
    }

    @Override
    public int getVisibleSize() {
        return DISPLAY_SIZE;
    }

    @Override
    public List<Point> getDisplayPoss() {
        return mPoss;
    }

    @Override
    public List<Point> getDisplaySizes() {
        return mSizes;
    }
}
